import java.net.URI;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by reone on 2019/3/26.
 */
public class StrTest {
    public static void main(String[] args) {
        List<Integer> arrayList = new ArrayList<>();
        for (int i = 150; i < 160; i++) {
            if (i == endNum(i)) {
                arrayList.add(i);
            }
        }
//        System.out.println(arrayList);
    }

    public static void uri(){
        System.out.println("out");
    }

    private static int endNum(int num) {
        int temp = num;
        while (true) {
            int newNum = cover(temp + "");
            if (newNum == temp) {
                break;
            } else {
                temp = newNum;
            }
        }
        return temp;
    }

    private static int cover(String str) {
        int sum = 0;
        System.out.print(str + ":");
        for (int i = 0; i < str.length(); i++) {
            sum += str.charAt(i);
            System.out.print("[" + str.charAt(i) + ": " + (int) str.charAt(i) + "]  ");
        }
        System.out.println();
        return sum;
    }

    private static int endNumStr(String str) {
        return endNum(cover(str));
    }
}
